# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=tuc
pkgver=0.11.0
pkgrel=1
pkgdesc="When cut doesn't cut it"
url="https://github.com/riquito/tuc"
license="GPL-3.0-or-later"
arch="all !s390x !riscv64" # blocked by rust/cargo
makedepends="cargo"
source="https://github.com/riquito/tuc/archive/v$pkgver/tuc-$pkgver.tar.gz
	$pkgname-regex-features-1.patch::https://github.com/riquito/tuc/commit/cd0b916e178ee81dc45b929c27db9c285f7dc123.patch
	$pkgname-regex-features-2.patch::https://github.com/riquito/tuc/commit/f4cd74255974d100fd932543248a132b100d9414.patch
	"

_cargo_opts='--frozen --features regex'

export CARGO_PROFILE_RELEASE_OPT_LEVEL="s"

prepare() {
	default_prepare

	cargo fetch --locked
}

build() {
	cargo build $_cargo_opts --release
}

check() {
	cargo test $_cargo_opts
}

package() {
	install -Dm755 target/release/tuc -t "$pkgdir"/usr/bin/
}

sha512sums="
d663c9ce1d7371b85e177cbcd2114e5bb615a75b7aa6fe110665d717252bc31e44617298450816ad016c4cccd6a9b33415b0777ae4dd5e933707ad7d824ad6b0  tuc-0.11.0.tar.gz
176d8bebfbe40c860c6e1b9a0fb71dc184989f69288c2c49de31229f95344bd49a4e805fc39848c13bbe96b5c786c926c952aa16bd4373ea43a9ee427c9471a8  tuc-regex-features-1.patch
0fdd303ee07ee03c24e1f223f0c22028613e5c9ec4749240e806379543befce52790f012d4756937dfc969a99d8cccb603bee4c3fc66608ea11e65413574cf22  tuc-regex-features-2.patch
"
